const express = require('express')
const {sendMessage, getMessages} = require('../../controllers/messageController')
const passport = require('../../middlewares/jwtAuthStrategy')
const {io} = require('../../socket/socket')
const router = express.Router()

router.post('/send/:id', passport.authenticate('jwt', {session: false}), sendMessage(io))
router.get('/:id', passport.authenticate('jwt', {session: false}), getMessages)

module.exports = router
